
@extends('layouts.admin')
@section('content')
     


        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">
            <div class="row-content am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title  am-cf">链接列表</div>


                            </div>
                            <div class="widget-body  am-fr">

                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                                    <div class="am-form-group">
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
												<a href="{{url('admin/friend/create')}}" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</a>
												
                                                <button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>
												
                                                <button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>
												
                                                <button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                               
                                <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">

                                </div>

                                <div class="am-u-sm-12">
                                    <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " id="example-r">
                                        <thead>
                                            <tr>
												<th>排序</th>
												<th>ID</th>
												<th>链接名</th>
												<th>URL</th>
												<th>链接标题</th>
												<th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
										@foreach($data as $v)
									<tr>
									<td class="tc">
										<input type="text" style="width:30px;background-color:#19A7F0;border-left:0px;border-top:0px;border-right:0px;border-bottom:1px;" value="{{$v->link_order}}" onchange="changeOrder(this,{{$v->link_id}})">
									</td>

									<td class="tc">{{$v->link_id}}</td>
									<td>
										<a href="#">{{$v->link_name}}</a>
									</td>
									<td >{{$v->link_url}}</td>
									<td>
										<a href="#">{{$v->link_title}}</a>
									</td>


									<td>
										{{--admin/user/1/edit--}}
										<div class="tpl-table-black-operation">
										<a href="{{url('admin/friend/'.$v->link_id.'/edit')}}"><i class="am-icon-pencil"></i>修改</a>
										<a href="javascript:;" class="tpl-table-black-operation-del" onclick="delUser({{$v->link_id}})"><i class="am-icon-trash"></i>删除</a>
										</div>
									</td>
								</tr>  
							@endforeach
                                            

                                           
                                            <!-- more data -->
                                        </tbody>
										
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
  <script>

        function changeOrder(obj,link_id){
//            获取用户输入的排序号
            var link_order = $(obj).val();

            $.post("{{url('admin/friend/changeorder')}}",{'_token':"{{csrf_token()}}",'link_id':link_id,'link_order':link_order},function(data){
                if(data.status == 0){
                    location.href = location.href;
                    layer.msg(data.msg, {icon: 6});
                }else{
                    location.href = location.href;
                    layer.msg(data.msg, {icon: 5});
                }
            });
        }

        function delUser(userid){
		
            //询问框
            layer.confirm('是否确认删除？', {
                btn: ['确定','取消'] //按钮
            }, function(){

                //            alert(userid);
//        $.post(url,data,function(){});
                $.post("{{url('admin/friend/')}}/"+userid,{'_method':'delete','_token':"{{csrf_token()}}"},function(data){
                    if(data.status == 0){
                        location.href = location.href;
                        layer.msg(data.msg, {icon: 6});
                    }else{
                        location.href = location.href;
                        layer.msg(data.msg, {icon: 5});
                    }


                });



            }, function(){

            });









        }



    </script>
@endsection
   
   
   
   